package com.firmail.cloud.mcenter.fallback;

import com.firmail.cloud.mcenter.IMockCenterServ;
import com.firmail.mock.center.api.vo.MockMetadata;
import com.firmail.mock.common.model.ReturnData;
import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

import java.io.IOException;

@Component
@Slf4j
public class IMockCenterServFallbackFactory implements FallbackFactory<IMockCenterServ>{

	@Override
	public IMockCenterServ create(Throwable cause) {
		return new IMockCenterServ() {

			@Override
			public ReturnData<?> createCrossPlfMock(MockMetadata data) throws IOException {
				log.error("FallbackFactory ** Throwable -> :  " + cause.getMessage());
				return null;
			}

			@Override
			public ReturnData<String> createMock(MockMetadata data) {
				log.error("FallbackFactory ** Throwable -> :  " + cause.getMessage());
				return null;
			}

			
		};
		/*return data ->{
			log.error("FallbackFactory ** Throwable -> :  " + cause.getMessage());
			return null;
		};*/
	}

}
